using UnityEngine;

public class DeathBringerIdleState : DeathBringerGroundState
{
    public DeathBringerIdleState(Enemy enemy, string animName) : base(enemy, animName) { }

    public override void Enter()
    {
        base.Enter();
        stateTimer = Enemy.idleTime;
    }

    public override void Update()
    {
        base.Update();
        if (Enemy.Player && Vector2.Distance(Enemy.Player.transform.position, Enemy.transform.position) <= 7)
        {
            Enemy.bossFightBegun = true;
        }
        if (Input.GetKeyDown(KeyCode.P))
        {
            StateMachine.ChangeTo(Enemy.Teleport);
        }
        if (stateTimer <= 0 && Enemy.bossFightBegun)
        {
            StateMachine.ChangeTo(Enemy.Battle);
        }
    }
}
